package com.allen.controller;

import com.allen.bean.Student;
import com.allen.service.Operation;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/toEdit")
public class ToEdit extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int sid = Integer.valueOf(req.getParameter("sid"));
        Student student = new Operation().findById(sid);
        req.setAttribute("student", student);
        req.getRequestDispatcher("/edit.jsp").forward(req, resp);

    }
}
